0<#import "/layout.html" as c>
    <@c.html title="Index">
    <!-- ================== 开始基础CSS样式引入 ================== -->
    <link type="text/css" href="${publicRoot}plugins/jquery-ui/themes/base/minified/jquery-ui.min.css"
          rel="stylesheet"/>
    <link type="text/css" href="${pluginsRoot}bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link type="text/css" href="${pluginsRoot}font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link type="text/css" href="${pluginsRoot}ztree/css/metroStyle/metroStyle.css" rel="stylesheet">
    <link type="text/css" href="${cssRoot}animate.min.css" rel="stylesheet"/>
    <link type="text/css" href="${cssRoot}style.min.css" rel="stylesheet"/>
    <link type="text/css" href="${cssRoot}style-responsive.min.css" rel="stylesheet"/>
    <link type="text/css" href="${cssRoot}theme/default.css" rel="stylesheet" id="theme"/>
    <link type="text/css" href="${cssRoot}style-plugins.css" rel="stylesheet"/>
    <!-- ================== 结束基础CSS样式引入 ================== -->

    <!-- ================== 开始页面所需CSS样式引入 ================== -->
    <link href="${pluginsRoot}gritter/css/jquery.gritter.css" rel="stylesheet"/>
    <!-- 表单验证 -->
    <link href="${pluginsRoot}parsley/parsley.min.css" rel="stylesheet"/>
    <!-- ================== 结束页面所需CSS样式引入 ================== -->
    <!--[if lt IE 9]>

    <![endif]-->
    <!-- ================== 开始基础JavaScript调用 ================== -->

    <!-- ================== 结束基础JavaScript调用 ================== -->

    <style type="text/css">
        .item-hover {
            background: #1a2229;
            color: #fff;
        }

        .table-title {
            background: #ffffff;
            text-align: center;
        }

        .mytable {
            color: #666;
            width: 96%;
            margin: 10px;
            background: #ffffff;
        }

        table tr {
            padding: 5px 0;
        }

        .tl {
            text-align: left;
        }

        .ta {
            text-align: center;
        }

        .mytable input {
            width: 220px;
            padding: 3px 6px;
            height: auto;
            border-radius: 5px;
            outline: none;
            border: 0;
            -webkit-appearance: none;
        }

        .mytable .lable {
            width: 100px;
            /*background: #eee;*/
        }

        .btn {
            padding-top: 1px;
            padding-bottom: 1px;
        }

        .base-info {
            max-width: 220px;
            width: 200px;
            white-space: nowrap;
            text-overflow: ellipsis;
            -o-text-overflow: ellipsis;
            overflow: hidden;
        }

        .mytable button {
            float: right;
        }

        tbody {
            padding: 1px;
        }

        select {
            min-width: 120px;
            padding: 3px 8px;
            color: #666;
            border-radius: 5px;
            outline: none;
        }

        .mytable .w25 {
            width: 25%;
        }

        .mytable .w30 {
            width: 30%;
        }

        .mytable .w45 {
            width: 45%;
        }

        .outable {
            color: #666;
            width: 35%;
            margin: 10px;
            background: #ffffff;
        }
        .outable input {
            width: 220px;
            padding: 3px 6px;
            height: auto;
            border-radius: 5px;
            outline: none;
            border: 0;
            -webkit-appearance: none;
        }

    </style>

    <!-- 开始页面内容 -->
    <div id="content" class="content">

        <!-- 开始面包屑导航 -->
        <ol class="breadcrumb pull-right">
            <li><a href="javascript:;">首页</a></li>
            <#list menuState.breadCrumbList as breadCrumb>
                <li class="">${breadCrumb}</li>
            </#list>
        </ol>
        <!-- 结束面包屑导航 -->

        <!-- 开始页头区域 -->
        <h1 class="page-header">风控配置
            <small class="m-l-10">风控参数配置</small>
        </h1>
        <!-- 结束页头区域 -->

        <!-- 品种列表 begin row -->
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-inverse" data-no-drag="true">
                    <div class="panel-body">
                        <div style="position: relative;">
                            <input type="hidden" id="userId" value="${userId}">
                            <table border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse;"
                                   class="mytable dt-grid table table-bordered  table-responsive">
                                <tbody>
                                <tr class="table-title dt-grid-headers ">
                                    <th class="lable ta" class="commo"></th>
                                    <th class="lable ta" class="commo">手续费</th>
                                    <th class="lable ta" class="commo">过夜费</th>
                                    <th class="lable ta" class="commo">开仓滑点</th>
                                    <th class="lable ta" class="commo">平仓滑点</th>
                                </tr>
                                <#list commoRiskList as item >
                                    <tr class="lable ta">
                                        <td>${item.commoName}(${item.commoCode})</td>
                                        <td><input class="param" type="text" data-value="${item.commoId!}" onkeyup= "if(/[^\d.]/g.test(this.value)){this.value=0;}"
                                                   value="${item.fee!0.00}">
                                            <button class="btn btn-default btn-s amend-btn1">保存</button>
                                        </td>
                                        <td><input class="param" type="text" data-value="${item.commoId!}" onkeyup= "if(/[^\d.]/g.test(this.value)){this.value=0;}"
                                                   value="${item.overnightFee!0.00}">
                                            <button class="btn btn-default btn-s amend-btn2">保存</button>
                                        </td>
                                        <td><input class="param" type="text" data-value="${item.commoId!}" onkeyup= "if(/[^\d.]/g.test(this.value)){this.value=0;}"
                                                   value="${item.openPoint!0}">
                                            <button class="btn btn-default btn-s amend-btn4">保存</button>
                                        </td>
                                        <td><input class="param" type="text" data-value="${item.commoId!}" onkeyup= "if(/[^\d.]/g.test(this.value)){this.value=0;}"
                                                   value="${item.settlePoint!0}">
                                            <button class="btn btn-default btn-s amend-btn5">保存</button>
                                        </td>
                                    </tr>
                                </#list>
                                </tbody>
                            </table>
                            </br>
                            <table border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse;"
                                   class="outable dt-grid table table-bordered  table-responsive">
                                <tbody>
                                <tr class="table-title dt-grid-headers ">
                                    <th class="lable ta" class="commo">清盘数值</th>
                                    <td><input class="param" type="text" value="${clearValue!0.00}" onkeyup= "if(/[^\d.]/g.test(this.value)){this.value=0;}">
                                        <button class="btn btn-default btn-s amend-btn3">保存</button>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</@c.html>

<!-- ================== 开始页面级JavaScrip调用 ================== -->
<script src="${pluginsRoot}bootstrap-wizard/js/bwizard.js"></script>
<!-- 表单checkbox项 -->
<script src="${pluginsRoot}bootstrap-switch/bootstrap-switch.min.js"></script>
<!-- 日历控件 -->
<script src="${pluginsRoot}/jquery.dtGrid/dependents/datePicker/WdatePicker.js" defer="defer"></script>
<!--<script src="${jsRoot}user/user_risk.handle.js"></script>-->
<script>
    $(function () {
        $('.amend-btn1').on('click', function () {
            var userId = $("#userId").val();
            var commoId = $(this).parent().find(".param").attr("data-value");
            var value = $(this).parent().find(".param").val();
            $.ajax({
                type: 'POST',
                url: ncGlobal.adminRoot + "user/json/riskEdit",
                dataType: "json",
                data: {
                    userId: userId,
                    commoId: commoId,
                    value: value,
                    mark:'fee'
                },
                success: function (data) {
                    if(data.code == 200){
                        alert("保存成功！");
                    }else{
                       alert(data.message);
                    }
                }
            })

        });

        $('.amend-btn2').on('click', function () {
            var userId = $("#userId").val();
            var commoId = $(this).parent().find(".param").attr("data-value");
            var value = $(this).parent().find(".param").val();
            $.ajax({
                type: 'POST',
                url: ncGlobal.adminRoot + "user/json/riskEdit",
                dataType: "json",
                data: {
                    userId: userId,
                    commoId: commoId,
                    value: value,
                    mark:'overnightFee'
                },
                success: function (data) {
                    if(data.code == 200){
                        alert("保存成功！");
                    }else{
                        alert(data.message);
                    }
                }
            })
        });

        $('.amend-btn4').on('click', function () {
            var userId = $("#userId").val();
            var commoId = $(this).parent().find(".param").attr("data-value");
            var value = $(this).parent().find(".param").val();
            $.ajax({
                type: 'POST',
                url: ncGlobal.adminRoot + "user/json/riskEdit",
                dataType: "json",
                data: {
                    userId: userId,
                    commoId: commoId,
                    value: value,
                    mark:'open'
                },
                success: function (data) {
                    if(data.code == 200){
                        alert("保存成功！");
                    }else{
                        alert(data.message);
                    }
                }
            })
        });

        $('.amend-btn5').on('click', function () {
            var userId = $("#userId").val();
            var commoId = $(this).parent().find(".param").attr("data-value");
            var value = $(this).parent().find(".param").val();
            $.ajax({
                type: 'POST',
                url: ncGlobal.adminRoot + "user/json/riskEdit",
                dataType: "json",
                data: {
                    userId: userId,
                    commoId: commoId,
                    value: value,
                    mark:'settle'
                },
                success: function (data) {
                    if(data.code == 200){
                        alert("保存成功！");
                    }else{
                        alert(data.message);
                    }
                }
            })
        });

        $('.amend-btn3').on('click', function () {
            var userId = $("#userId").val();
            var value = $(this).parent().find(".param").val();
            $.ajax({
                type: 'POST',
                url: ncGlobal.adminRoot + "user/json/clearValueEdit",
                dataType: "json",
                data: {
                    userId: userId,
                    value: value
                },
                success: function (data) {
                    if(data.code == 200){
                        alert("保存成功！");
                    }else{
                        alert(data.message);
                    }
                }
            })
        });
    });
</script>